43. Exercise: Teaching Pac-Man to Search (Optional)

Teaching Pac-Man to Search

In this lab, you will be using BFS, DFS, and A Star to teach Pac-Man to navigate his world in the most efficient way possible.

In this lab, you will be using BFS, DFS, and A Star to teach Pac-Man to navigate his world in the most efficient way possible.

Overview

In this exercise, you will teach Pac-Man to search his world to complete the following tasks:

  • find a single obstacle.
  • find multiple obstacles.
  • find the fastest way to eat all the food in the map.

This lab is possible thanks to the generous contributions of the UC Berkeley AI division and their work on the Pac-Man Project. The below is an example of what your AI will help Pac-Man do by the end of this lab!

Pac-Man using A* search to find the fastest way to all the food.

Pac-Man using A* search to find the fastest way to all the food.

Instructions

  1. Download the Pac-Man search code below.
  2. Follow the instructions for the problem set here.
  3. Once you have received a score of 25 you have successfully completed the lab. Please do not share your answers on a blog post etc. as this is one of the requests made by the project's maintainers.
  4. There is no submission for this lab. It is highly recommended to complete it though so that you can further improve your understanding of the material.

As an alternative to the above, you can continue to the next lesson which includes all the required files in a Workspace. (NOTE: you cannot run the pacman.py visualization script from within the Workspace; you will need to download your code and run it locally to see the search visualizations.)

Help

Remember that you can get assistance from Study Groups or Knowledge. You can also review the concepts from the previous lessons.